<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let a = prompt("输入姓：")
        let arr = ["张三", "张武", "王榴", "王麒", "李霸", "李玖", "刘仕"]
        let arr1 = []
        arr.forEach(function(v) {
            if (v.indexOf(a) !== -1) {
                // console.log(v);
                // document.write(v)
                arr1.push(v)
            }
        });
        document.write(arr1)
        console.log(arr1);
        if (arr1.length == 0) {
            document.write("没有")
        }
    </script>
</body>

</html>